package sjd.ahsj.springbootmybatisplusoracle.service;

import org.apache.ibatis.annotations.Param;
import sjd.ahsj.springbootmybatisplusoracle.entity.IDataDefine;
import sjd.ahsj.springbootmybatisplusoracle.entity.IFactory;
import com.baomidou.mybatisplus.service.IService;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author zhanghaogao
 * @since 2018-10-18
 */
public interface IIFactoryService extends IService<IFactory> {

    /**
     * 创建实时和历史表
     *
     * @param iDataDefines
     */
    Integer createCurrentAndHistory(Long factoryId, List<IDataDefine> iDataDefines);


    /**
     * 获取电站历史数据
     *
     * @param factoryId
     * @return
     */
    List<Map<String, Object>> selectFactoryInfoHistory(Integer factoryId, Date date);

    /**
     * 获取机组信息
     *
     * @param num
     * @return
     */
    Map<String, Object> selectFactoryInfo(Integer num, Integer factoryId);


    /**
     * 获取机组信息
     *
     * @param num
     * @return
     */
    Map<String, Object> selectFactoryInfo(Integer num, Integer factoryId, String sql);


    /**
     * 新增历史数据
     *
     * @param map
     * @return
     */
    Integer insertHistoryInfo(Integer factoryId, Map<String, Object> map);

    /**
     * 新增绘图数据
     *
     * @param map
     * @return
     */
    Integer insertPlotInfo(Integer factoryId, Map<String, Object> map, Date date);

    /**
     * 查询绘图数据
     *
     * @param factoryId
     * @param sql
     * @param stDate
     * @param enDate
     * @param type
     * @return
     */
    Map<String, Object> selectPlotInfoBySql(Integer factoryId, String sql, Date stDate, Date enDate, Integer type);

    List<Map<String, Object>> selectPlotInfoBySql(Integer factoryId, Integer type);


    /**
     * 删除绘图表历史数据
     *
     * @param factoryId
     * @param enDate
     * @param type
     * @return
     */
    Integer delPlotInfoByType(Integer factoryId, Date enDate, Integer type);
}
